package com.yc.edu.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * @author YC
 * @version 1.0
 * CREATE TABLE comment_info
 * (
 * id		BIGINT(20) AUTO_INCREMENT COMMENT 'id 主键',
 * post_id		VARCHAR(32) NOT NULL COMMENT '帖子id[外键]',
 * user_name	VARCHAR(100) NOT NULL COMMENT '用户姓名',
 * user_avatar	VARCHAR(255) NOT NULL COMMENT '用户头像',
 * recomment_flag 	VARCHAR(255) NOT NULL COMMENT '是否推荐',
 * content		LONGTEXT NOT NULL COMMENT '回复内容',
 * zan		INT NOT NULL DEFAULT 0 COMMENT '赞同数',
 * comment_time 	DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '回复时间',
 * PRIMARY KEY (id)
 * )CHARSET=utf8mb4 COMMENT '帖子评论表';
 */
@Data
@TableName("comment_info")
public class PostComments {
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @TableField("post_id")
    private String postId;

    @TableField("user_name")
    private String username;

    @TableField("user_avatar")
    private String userAvatar;

    // 是否推荐此回复
    @TableField("recomment_flag")
    private String recommentFlag;

    // 回复内容
    private String content;

    // 获赞数
    private Integer zan;

    // 回复时间
    @TableField("comment_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime commentTime;

    @TableField("course_id")
    private Integer courseId;
}
